package com.fita.admin.entity.search;

import com.demo2do.core.persistence.support.QueryBuilder;
import com.demo2do.core.persistence.support.QueryFilter;
import com.demo2do.core.persistence.support.QueryOrder;

import java.util.Map;

/**
 * @description:
 * @author: 11200
 * @date: 2019/6/26
 */
public abstract class AbstractSearch implements QueryBuilder {

    protected QueryFilter filter;

    protected QueryOrder order;

    public AbstractSearch() {

    }

    /**
     * get order
     *
     * @return
     */
    @Override
    public QueryOrder getOrder() {

        if (this.order == null){
            this.order = new QueryOrder();
        }
        return this.order;
    }

    /**
     * build query string template corresponding parameters
     *
     * @return
     */
    @Override
    public Map<String, Object> buildParameters() {
        return getPreparedFilter(false).parameters();
    }

}
